// https://zm.quya.vip/api/v1/putQuestionsTo
import tokenStore from "../utils/tokenStore";
export const putQuestionsTo = async ({function_id,content}) => {
	return await new Promise(function(resolve, reject) {
		uni.request({
			method: 'POST',
			url: 'https://zm.quya.vip/api/v1/putQuestionsTo',
			header: {
				'Authorization': 'Bearer ' + tokenStore.get()
			},
			data:{
				function_id,
				content,
			},
			success: (res) => {
				console.log(res)
				if (res.data.code == 200) {
					let data = res.data.data;
					data.content = (''+data.content).replace('\n','<br/>');
					data.content = (''+data.content).replace(/[\r\n]/g,'<br/>');
					resolve(data)
				} else {
					uni.showToast({
						title: res.data.message || res.data.msg,
						icon: 'none'
					})
					reject(res.data)
				}
			}
		});
	});
}